home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1994 February: Tool Chest / Dev.CD Feb 94.toast / Tool Chest / Development Platforms / MPW Related / MPW Interfaces / CIncludes / Picker.h < prev    next >
Encoding:
C/C++ Source or Header  |  1993-09-17  |  2.3 KB  |  88 lines  |  [TEXT/MPS ]

  1. /*
  2.     File:        Picker.h
  3.  
  4.     Copyright:    © 1983-1993 by Apple Computer, Inc.
  5.                 All rights reserved.
  6.  
  7.     Version:    System 7.1 for ETO #11
  8.     Created:    Tuesday, March 30, 1993 18:00
  9.  
  10. */
  11.  
  12. #ifndef __PICKER__
  13. #define __PICKER__
  14.  
  15. #ifndef __QUICKDRAW__
  16. #include <Quickdraw.h>
  17. #endif
  18.  
  19.  
  20. enum {
  21.  
  22.  MaxSmallFract = 0x0000FFFF            /*Maximum small fract value, as long*/
  23. };
  24.  
  25. /* A SmallFract value is just the fractional part of a Fixed number,
  26. which is the low order word.  SmallFracts are used to save room,
  27. and to be compatible with Quickdraw's RGBColor.  They can be
  28. assigned directly to and from INTEGERs. */
  29.  
  30. typedef unsigned short SmallFract;    /* Unsigned fraction between 0 and 1 */
  31.  
  32. /* For developmental simplicity in switching between the HLS and HSV
  33. models, HLS is reordered into HSL. Thus both models start with
  34. hue and saturation values; value/lightness/brightness is last. */
  35.  
  36. struct HSVColor {
  37.  SmallFract hue;                    /*Fraction of circle, red at 0*/
  38.  SmallFract saturation;                /*0-1, 0 for gray, 1 for pure color*/
  39.  SmallFract value;                    /*0-1, 0 for black, 1 for max intensity*/
  40. };
  41.  
  42. typedef struct HSVColor HSVColor;
  43.  
  44. struct HSLColor {
  45.  SmallFract hue;                    /*Fraction of circle, red at 0*/
  46.  SmallFract saturation;                /*0-1, 0 for gray, 1 for pure color*/
  47.  SmallFract lightness;                /*0-1, 0 for black, 1 for white*/
  48. };
  49.  
  50. typedef struct HSLColor HSLColor;
  51.  
  52. struct CMYColor {
  53.  SmallFract cyan;
  54.  SmallFract magenta;
  55.  SmallFract yellow;
  56. };
  57.  
  58. typedef struct CMYColor CMYColor;
  59.  
  60.  
  61. #ifdef __cplusplus
  62. extern "C" {
  63. #endif
  64. pascal SmallFract Fix2SmallFract(Fixed f)
  65.  = {0x3F3C,0x0001,0xA82E}; 
  66. pascal Fixed SmallFract2Fix(SmallFract s)
  67.  = {0x3F3C,0x0002,0xA82E}; 
  68. pascal void CMY2RGB(const CMYColor *cColor,RGBColor *rColor)
  69.  = {0x3F3C,0x0003,0xA82E}; 
  70. pascal void RGB2CMY(const RGBColor *rColor,CMYColor *cColor)
  71.  = {0x3F3C,0x0004,0xA82E}; 
  72. pascal void HSL2RGB(const HSLColor *hColor,RGBColor *rColor)
  73.  = {0x3F3C,0x0005,0xA82E}; 
  74. pascal void RGB2HSL(const RGBColor *rColor,HSLColor *hColor)
  75.  = {0x3F3C,0x0006,0xA82E}; 
  76. pascal void HSV2RGB(const HSVColor *hColor,RGBColor *rColor)
  77.  = {0x3F3C,0x0007,0xA82E}; 
  78. pascal void RGB2HSV(const RGBColor *rColor,HSVColor *hColor)
  79.  = {0x3F3C,0x0008,0xA82E}; 
  80. pascal Boolean GetColor(Point where,ConstStr255Param prompt,const RGBColor *inColor,
  81.  RGBColor *outColor)
  82.  = {0x3F3C,0x0009,0xA82E}; 
  83. #ifdef __cplusplus
  84. }
  85. #endif
  86.  
  87. #endif
  88.